//Source file: C:\\uml-generated-code\\com\\club325\\voicemicroblog\\Business\\StaticControllerImplement.java

package com.club325.voicemicroblog.persist;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.club325.voicemicroblog.database.hibernateutil.HibernateUtil;
import com.club325.voicemicroblog.domain.Focus;
import com.club325.voicemicroblog.domain.ForbiddenUser;
import com.club325.voicemicroblog.domain.VoiceFile;

/**
 * Class StaticControllerImplement
 */
public class StaticControllerImplement implements StaticControllerUtil {
	public ForbiddenUser theForbiddenUser;

	/**
	 * Fields Constructors
	 */
	public StaticControllerImplement() {

	}
	/**
	 * 
	 * Methods
	 * 
	 * Accessor methods
	 * 
	 * Other methods
	 */

	public int getCountofListenersonFocus(String UserID) {
		if(UserID == null)
			return -1;
		try
		{
			Criteria crit = HibernateUtil.getSession().createCriteria(Focus.class);
			crit.add(Restrictions.eq("Speaker", UserID));
			return crit.list().size();
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return -1;
		}
	}

	public int getCountofSpeakersonFocus(String UserID) {
		if(UserID == null)
			return -1;
		try
		{
			Criteria crit = HibernateUtil.getSession().createCriteria(Focus.class);
			crit.add(Restrictions.eq("Listener", UserID));
			return crit.list().size();
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return -1;
		}
	}

	public int getCountofVoiceBlog(String UserID) {
		if(UserID == null)
			return -1;
		try
		{
			Criteria crit = HibernateUtil.getSession().createCriteria(VoiceFile.class);
			crit.add(Restrictions.eq("Speaker", UserID));
			return crit.list().size();
		}
		catch(Exception e)
		{
			e.printStackTrace();
			return -1;
		}
	}
}
